package com.ruoyi.resume.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.resume.domain.BoleResumes;
import com.ruoyi.resume.service.IBoleResumesService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 简历主体Controller
 * 
 * @author wujiale
 * @date 2025-04-01
 */
@RestController
@RequestMapping("/resume/resumes")
public class BoleResumesController extends BaseController
{
    @Autowired
    private IBoleResumesService boleResumesService;

    /**
     * 查询简历主体列表
     */
    @PreAuthorize("@ss.hasPermi('resume:resumes:list')")
    @GetMapping("/list")
    public TableDataInfo list(BoleResumes boleResumes)
    {
        startPage();
        List<BoleResumes> list = boleResumesService.selectBoleResumesList(boleResumes);
        return getDataTable(list);
    }

    /**
     * 导出简历主体列表
     */
    @PreAuthorize("@ss.hasPermi('resume:resumes:export')")
    @Log(title = "简历主体", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BoleResumes boleResumes)
    {
        List<BoleResumes> list = boleResumesService.selectBoleResumesList(boleResumes);
        ExcelUtil<BoleResumes> util = new ExcelUtil<BoleResumes>(BoleResumes.class);
        util.exportExcel(response, list, "简历主体数据");
    }

    /**
     * 获取简历主体详细信息
     */
    @PreAuthorize("@ss.hasPermi('resume:resumes:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(boleResumesService.selectBoleResumesById(id));
    }

    /**
     * 新增简历主体
     */
    @PreAuthorize("@ss.hasPermi('resume:resumes:add')")
    @Log(title = "简历主体", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BoleResumes boleResumes)
    {
        return toAjax(boleResumesService.insertBoleResumes(boleResumes));
    }

    /**
     * 修改简历主体
     */
    @PreAuthorize("@ss.hasPermi('resume:resumes:edit')")
    @Log(title = "简历主体", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BoleResumes boleResumes)
    {
        return toAjax(boleResumesService.updateBoleResumes(boleResumes));
    }

    /**
     * 删除简历主体
     */
    @PreAuthorize("@ss.hasPermi('resume:resumes:remove')")
    @Log(title = "简历主体", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(boleResumesService.deleteBoleResumesByIds(ids));
    }
}
